package com.hongyun.tms.web.controller;

import com.hongyun.tms.domain.AjaxResult;
import com.hongyun.tms.entity.PordWork;
import com.hongyun.tms.entity.TmsMTug;
import com.hongyun.tms.service.FirstPageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

/**
* 首页
*
* @author yuheng
* @since 1.0.0 2024-06-06
*/
@RestController
@RequestMapping("/firstPage")
@Api(value = "首页", tags = "首页")
@AllArgsConstructor
public class FirstPageController {
    private final FirstPageService homeService;

    /**
     * 计划、完成 情况
     */
    @GetMapping("getPlanNum")
    @ApiOperation(value = "传入时间", notes = "planDte")
    public AjaxResult getPlanNum(String planDte){
        HashMap<String, BigDecimal> planNumList = homeService.getPlanNum(planDte);
        return AjaxResult.success(planNumList);
    }

    /**
     * 本年度拖轮使用情况
     */
    @GetMapping("getWorkItemGroup")
    @ApiOperation(value = "传入时间", notes = "planDte")
    public AjaxResult getWorkItemGroup(String planDte){
        List<HashMap<String, Object>> workItemGroup = homeService.getWorkItemGroup(planDte);
        return AjaxResult.success(workItemGroup);
    }

    /**
     * 本年度费用情况
     */
    @GetMapping("getFeeList")
    public AjaxResult getFeeList(){
        List<HashMap<String, Object>> feeList = homeService.getFeeList();
        return AjaxResult.success(feeList);
    }
    /**
     * 拖轮情况
     */
    @GetMapping("getTmsMTug")
    public AjaxResult getTmsMTug(){
        List<TmsMTug> tmsMTugList = homeService.getTmsMTug();
        return AjaxResult.success(tmsMTugList);
    }
    /**
     * 根据拖轮情况动态展示拖轮作业情况
     */
    @GetMapping("getWorkByTmsMTug")
    @ApiOperation(value = "传入拖轮id", notes = "id")
    public AjaxResult getWorkByTmsMTug(String id){
        List<PordWork> workByTmsMTugList = homeService.getWorkByTmsMTug(id);
        return AjaxResult.success(workByTmsMTugList);
    }
    /**
     * 按照月度查询油电水情况
     * sumOriCost 油耗
     * sumWaterCost 水耗
     * sumPowerCost 电耗
     * sumOriAddVolume 加油量
     * sumLeftMainWorkHours 左主机时长
     * sumRightMainWorkHours 右主机时长
     * sumOneAuxBegNum 1号副机时长
     * sumTwoAuxBegNum 2号副机时长
     */
    @GetMapping("getConsumeTmsMTug")
    public AjaxResult getConsumeTmsMTug(){
        List<HashMap<String,Object>> consumeTmsMTugList = homeService.getConsumeTmsMTug();
        return AjaxResult.success(consumeTmsMTugList);
    }
}
